DIALOGBOX 71, 20, 235, 98, 21, "Dynamic Data Exchange Demo"
LTEXT 8, 10, 225, 24, "This part of the TOUR will demonstrate WinComm acting both as a DDE Client and as a DDE Server. The Client Server menu selection requires only WinComm to be installed. The other "
LTEXT 8, 34, 230, 16, "selections require Microsoft Excel and Pioneer Software Q+E to be installed and in the path. If they are not the demo will terminate."
DEFCANCELBUTTON 91, 69, 50, 14, "&OK"
DEND
DO i = DIALOG? UNTIL(i != 255)
main_loop:
i = MENU?
IF(i==2) GOTO win_return
ELSE IF(i==3) GOTO clint_ser
ELSE IF(i==4) GOTO excel
ELSE IF(i==5) GOTO qpluse
GOTO main_loop
;************************** DDE|Client Server ******************************
clint_ser:
DIALOGBOX 87, 20, 201, 129, 21, "WinComm Client Server Demo"
LTEXT 18, 11, 165, 18, "This demo will start another copy of WinComm and will exchange data with it."
LTEXT 18, 31, 165, 51, "This WinComm will get the session notes from the other WinComm and then set up an ADVISE on one of its variables. Double click on the other WinComm and see the variable changing. When finished watching, close the other WinComm."
DEFCANCELBUTTON 76, 98, 50, 14, "&OK"
DEND
DO i = DIALOG? UNTIL(i != 255)
ENABLEMENU(m1,2,1) ;disable menu
ENABLEMENU(sm1,3,1)
ENABLEMENU(sm1,4,1)
ENABLEMENU(sm1,5,1)
SHOWBAR(m1)
WINMOVE(1,1,638,410) ;position and size wincomm
a$ = ""
wcpath$ = GETSESSSTR(25)
wcpath$ = wcpath$+"\WINCOMM.EXE"
ddechan = DDEINIT("WINCOMM","DDESERV.WMC") ;test to see if there is a wincomm there
IF(ddechan==0){ ;guess not...
RUN(wcpath$,"",2) ;start one as an icon
ddechan = DDEINIT("WINCOMM","DDESERV.WMC") ;same as the other DDEINIT causes WinComm
IF(ddechan==0){ ;to load and run DDESERV macro
ALERT("Initaite Failed, result = "+strint(ddechan ))
SHOW(3) ;Things are not going well
GOTO exit
}
}
DDEREQ(ddechan,a$,"1000") ;asking for the "notes" string variable of the session file
PRINT("Notes are ["+a$+"]^M^J") ;DDE session integers and strings are identified using the
a$="" ;id's in the macro manual + 1000
DDEADVISE(ddechan,a$,"a$") ;asks the other wincomm to let this one know when its a$ variable
again: ;has changed
i = TIME?+5 ;
DO ;a test to see when the other wincomm
UNTIL( (NULL(a$)!=1) || (TIME?>i)) ;goes away---if nothing happens in five
IF(TIME?>i){ ;seconds, shut this sucker down
SHOW(3) ;
GOTO exit ;
}
PRINT(a$+"^M^J") ;otherwise print the variable sent from the other wincomm
DIALOGBOX 87, 20, 212, 104, 21, "WinComm Client/Q+E Server Demo"
LTEXT 8, 18, 198, 33, "For this demo to work, 'Q+E' must be installed and in the path given below. The default query will select all cities so you can see the entries in the other fields for your own queries."
CANCELBUTTON 118, 80, 50, 14, "&Cancel"
DEFPUSHBUTTON 43, 80, 50, 14, "&OK"
EDIT 13, 63, 188, 12, QEPATH$
LTEXT 13, 52, 42, 9, "Q+E path:"
DEND
DO dg=DIALOG? UNTIL(dg != 255)
IF(dg==0) GOTO exit1
macropath$ = GETSESSSTR(28)
FCLOSE(FOPEN(4096,macropath$+"\QUERY.TXT")) ;create a null file query.txt
query1$ = macropath$+"\QUERY.TXT"
ddechan = DDEINIT("QE","SYSTEM")
IF(ddechan==0){
inst = RUN(qepath$+"\QE.EXE","",2)
IF(inst < 32){
ALERT("Problem running Q+E. Check path or available memory and re-run.")
GOTO exit1
}
ddechan = DDEINIT("QE","SYSTEM")
IF(ddechan==0){
ALERT("Q+E Initiate Failed, result = "+strint(ddechan ))
GOTO exit1
}
}
WINMOVE(1,1,638,400) ;position and size wincomm
ACTIVATE ;give the focus back to WinComm to display dialog box